﻿Public Class RtomaAccion

    Public Shared Function SeleccionarTodoXPosCliente(ByVal descEmpresa As String, ByVal pProforma As EproformaCabecera) As List(Of EtomaAccion)
        Dim tomaAccions As List(Of EtomaAccion) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                tomaAccions = DtomaAccion.SeleccionarTodoXPosCliente(descEmpresa, pProforma)
                If tomaAccions Is Nothing Then tomaAccions = New List(Of EtomaAccion)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return tomaAccions
    End Function
    Public Shared Function SeleccionarTodoXCliente(ByVal descEmpresa As String, ByVal pSeparacionVenta As EseparacionVenta) As List(Of EtomaAccion)
        Dim tomaAccions As List(Of EtomaAccion) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                tomaAccions = DtomaAccion.SeleccionarTodoXCliente(descEmpresa, pSeparacionVenta)
                If tomaAccions Is Nothing Then tomaAccions = New List(Of EtomaAccion)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return tomaAccions
    End Function
    Public Shared Function Añadir(ByVal descEmpresa As String, ByVal paccion As EtomaAccion) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DtomaAccion.Añadir(descEmpresa, paccion)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function
    Public Shared Function Editar(ByVal descEmpresa As String, ByVal paccion As EtomaAccion) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DtomaAccion.Editar(descEmpresa, paccion)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function

End Class
